<link rel="stylesheet" href="${root!}/public/tree/css/demo.css" type="text/css">
<link rel="stylesheet" href="${root!}/public/tree/css/zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="${root!}/public/tree/js/jquery.ztree.core-3.5.js"></script>
<script type="text/javascript" src="${root!}/public/tree/js/jquery.ztree.excheck-3.5.js"></script>
<script type="text/javascript" src="${root!}/public/tree/js/jquery.ztree.exedit-3.5.js"></script>
<script type="text/javascript">

    var setting = {
        view: {
            selectedMulti: false
        },
        check: {
            enable: true
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            onCheck: onCheck
        }
    };

    var clearFlag = false;
    var select_role;

    function onCheck(e, treeId, treeNode) {
        var zTree = $.fn.zTree.getZTreeObj("treeDemo");
        checkCount = zTree.getCheckedNodes(true);
        select_role= checkCount;
    }

    function get(){
        var zTree = $.fn.zTree.getZTreeObj("treeDemo");
        checkCount = zTree.getCheckedNodes(true);

        return checkCount;
    }

    $(document).ready(function(){
        $.ajax({
            url:"admin/role/load_role_resource_tree?role_id=${role_id}",
            dataType:"json",
            success:function(data){
                $.fn.zTree.init($("#treeDemo"), setting, data);
            }
        })
    });
</script>
<div id="rs_role" >
    <ul id="treeDemo" class="ztree" style="margin-top:0; width:260px;"></ul>
</div>